package com.huadao.pda.data.http;


import com.huadao.pda.data.bean.DeviceInfo;
import com.huadao.pda.data.bean.Dispensing;
import com.huadao.pda.data.bean.Project;
import com.huadao.pda.data.bean.ProjectListByPage;
import com.huadao.pda.data.bean.SweepCode;
import com.huadao.pda.data.bean.User;

import java.util.List;

import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.Url;

public interface Api {

    @POST
    Observable<BaseLoginResponse<String>> login(@Url String url, @Body User user);

    @POST("api/DeviceInfo/CreateAsync")
    Observable<BaseResponse<DeviceInfo>> createDevice(@Body DeviceInfo deviceInfo);

    @GET("api/DeviceInfo/GetAsync/{id}")
    Observable<BaseResponse<DeviceInfo>> getDeviceById(@Path("id") String id);

    @GET("api/Project/UpdateDeviceId/UpdateDeviceId")
    Observable<BaseResponse> updateDeviceId(@Query("id") String id);

    @GET("api/Project/PagerQueryAsync")
    Observable<BaseResponse<ProjectListByPage>> getProjectByPage(@Query("page") int page, @Query("pageSize") int pageSize);

    @GET("api/Project/QueryAsync/Query")
    Observable<BaseResponse<List<Project>>> getAllProject();

    @GET("api/Project/QueryAsync/Query")
    Observable<BaseResponse<List<Project>>> queryProject(@Query("identifier") String identifier);

    @GET("api/Project/BindingProject/BindingProject")
    Observable<BaseResponse<Boolean>> bindingProject(@Query("projectId") String projectId,@Query("deviceId") String deviceId);

    @GET("api/Dispensing/Consuming/Consuming")
    Observable<BaseResponse<Boolean>> consumingDispensing(@Query("barCode") String barCode);

    @GET("api/Dispensing/QueryAsync/Query")
    Observable<BaseResponse<List<Dispensing>>> queryDispensing(@Query("projectId") String projectId,@Query("isUse") Boolean isUse);

    @POST("api/DeviceInfo/SweepCode/SweepCode")
    Observable<BaseResponse<Boolean>> sweepCodeLogin(@Body SweepCode sweepCode);
}
